<template>
  <div>
    <el-row :gutter="10">
      <el-col :span="6">
        <el-button type="primary" @click="handleDialog">打开对话框</el-button>
      </el-col>
    </el-row>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="width">
      <!-- <span>这是一段信息</span>
          <div slot="footer">
              
              <el-button @click="dialogVisible = false">取 消</el-button>
              <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
          </div> -->
      <el-form ref="form" :model="user" label-width="80px">
        <el-form-item label="用户名">
          <el-input
            v-model="user.username"
            placeholder="请输入用户名"
          ></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input v-model="user.password" placeholder="请输入密码"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="handleLogin">登入</el-button>
          <el-button type="primary" @click="dialogVisible = false"
            >取消</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "Dialog",
  methods: {
    handleLogin() {
      alert("登入成功")
      this.dialogVisible=false
    },
    handleDialog(){
        this.dialogVisible=true
    }
  },
  data() {
    return {
      dialogVisible: false,
      user:{
          username:"",
          password:""
      }
    };
  },
};
</script>

<style>
</style>